package com.example.Administrator.shoujiweishi.fragments;

import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.example.Administrator.shoujiweishi.R;
import com.example.Administrator.shoujiweishi.activities.adapter.ShowAllAdapter;
import com.example.Administrator.shoujiweishi.fragments.base.BaseFragment;
import com.example.Administrator.shoujiweishi.vo.Contact;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/6/8 0008.
 */

public class SelectContacts extends BaseFragment{

    private static RecyclerView select_recyclerview;
    private static ShowAllAdapter myAdapter;
    private List<Contact> lists=new ArrayList<Contact>();

    @Override
    public int getContentXML() {
        return R.layout.selectcontact_item;
    }

    @Override
    public void initData() {

    }
    @Override
    public void initView() {

        select_recyclerview= (RecyclerView) getthisview().findViewById(R.id.select_recyclerview);
        select_recyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
        select_recyclerview.addItemDecoration(new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL));
        myAdapter = new ShowAllAdapter(lists);
        select_recyclerview.setAdapter(myAdapter);
    }

    public void getSelectContactList(List<Contact>  contacts){
        lists.clear();
        lists.addAll(contacts);
        if(myAdapter!=null) {
            myAdapter.notifyDataSetChanged();
        }

    }
}
